import os
import re

# 1.读入 filein.c 文件 ，将其存储在 content 字符串中

import os

input_path = 'filein.c'

os.chdir(os.path.dirname(__file__))
with open(input_path, 'r', encoding='utf-8') as file_obj:
    content = file_obj.read()
# print(content)
# 2.统计 content 字符串的字符总个数 total
total = len(content)
# 3.使用正则匹配 /* */ 之间的字符串的个数 comm
pat = r'/\*((?:.|\n)*?)\*/'
comm_str = re.finditer(pat, content)
comm = 0

for i in comm_str:
    comm += len(i.group()) - 4
# print(comm)
# 4.计算输出结果 comm / total% 
print('{}%'.format(int(comm / total * 100)))


def isPrime(n):
    if n < 2: return 0
    for i in range(2, n - 1):
        if n % i == 0:
            return 0
    return 1
